package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.AttendanceSheet;
import cn.wolfcode.crm.mapper.AttendanceSheetMapper;
import cn.wolfcode.crm.query.ShareQueryObject;
import cn.wolfcode.crm.service.IAttendanceSheetService;
import cn.wolfcode.crm.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class AttendanceSheetServiceImpl implements IAttendanceSheetService {

    @Autowired
    private AttendanceSheetMapper attendanceSheetMapper;


    public int deleteByPrimaryKey(Long id) {
        return attendanceSheetMapper.deleteByPrimaryKey(id);
    }

    public int insert(AttendanceSheet entity) {
        return attendanceSheetMapper.insert(entity);
    }

    public AttendanceSheet selectByPrimaryKey(Long id) {
        return attendanceSheetMapper.selectByPrimaryKey(id);
    }

    public List<AttendanceSheet> selectAll() {
        return attendanceSheetMapper.selectAll();
    }

    public int updateByPrimaryKey(AttendanceSheet entity) {
        return attendanceSheetMapper.updateByPrimaryKey(entity);
    }

    public PageResult query(ShareQueryObject qo) {

        int total = attendanceSheetMapper.queryForCount(qo);

        if(total == 0){
            return new PageResult();
        }

        List<AttendanceSheet> list = attendanceSheetMapper.queryForList(qo);

        return new PageResult(total,list);
    }

    public List<AttendanceSheet> selectExport() {
        return attendanceSheetMapper.selectAll();
    }


}
